package com.dffl.es.esstudy.document;

import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Document(indexName = "center_goods",shards = 6,replicas = 2,type = "sku")
public class EsSku implements Serializable {

    @Id
    @ApiModelProperty(value = "主键")
    private Long id;

    @Field(analyzer = "ik_max_word",type = FieldType.Text,searchAnalyzer = "ik_smart")
    @ApiModelProperty(value = "sku名称(copy from t_spu.spu_name)")
    private String skuName;
    @Field(type = FieldType.Keyword)
    @ApiModelProperty(value = "sku编码")
    private String skuCode;
    @Field(type = FieldType.Keyword)
    @ApiModelProperty(value = "条形码(从供应商档取第一个条形码)")
    private String barCode;
    @Field(type = FieldType.Text)
    @ApiModelProperty(value = "规格图")
    private String picUrl;
    @ApiModelProperty(value = "spu id")
    private Long spuId;
    @Field(type = FieldType.Object,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private EsSpu spu;

    @ApiModelProperty(value = "商品类型（copy from t_spu.spu_typ）1:普通;2:组合商品;3:加工原料;4:商品辅料;5:物流辅料;6:样品;7:赠品;8:套餐商品")
    private Integer skuType;
    @Field(analyzer = "ik_max_word",type = FieldType.Text)
    @ApiModelProperty(value = "规格1")
    private String spec1;
    @Field(analyzer = "ik_max_word",type = FieldType.Text)
    @ApiModelProperty(value = "规格2")
    private String spec2;
    @Field(analyzer = "ik_max_word",type = FieldType.Text)
    @ApiModelProperty(value = "规格3")
    private String spec3;
    @Field(analyzer = "ik_max_word",type = FieldType.Text)
    @ApiModelProperty(value = "规格4")
    private String spec4;
    @Field(type = FieldType.Keyword)
    @ApiModelProperty(value = "创建者")
    private Integer creator;
    @Field(type = FieldType.Keyword)
    @ApiModelProperty(value = "修改者")
    private Integer modifier;

    @ApiModelProperty(value = "创建时间")
    private Date createdAt;

    @ApiModelProperty(value = "更新时间")
    private Date updatedAt;

    @ApiModelProperty(value = "生命周期状态（1：正常；2：停售；3：季节停售；4：退场；5：永久汰换）")
    private Integer lifeCycle;

    @ApiModelProperty(value = "数据迁移临时暂用")
    private Integer goodsId;

    @ApiModelProperty(value = "有效期开始时间（组合商品）")
    private Date effectiveTime;

    @ApiModelProperty(value = "有效期结束时间（组合商品）")
    private Date expiredTime;

    @ApiModelProperty(value = "首次上架时间")
    private Date firstOnShelfTime;

    @ApiModelProperty(value = "规格名称")
    private String specName;
    @Field(type = FieldType.Object)
    @ApiModelProperty(value = "价格列表")
    private List<EsPrice> priceList = new ArrayList<>();

    public List<EsPrice> getPriceList() {
        return priceList;
    }

    public void setPriceList(List<EsPrice> priceList) {
        this.priceList = priceList;
    }



    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSkuName() {
        return skuName;
    }

    public void setSkuName(String skuName) {
        this.skuName = skuName;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public String getBarCode() {
        return barCode;
    }

    public void setBarCode(String barCode) {
        this.barCode = barCode;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public Long getSpuId() {
        return spuId;
    }

    public void setSpuId(Long spuId) {
        this.spuId = spuId;
    }

    public Integer getSkuType() {
        return skuType;
    }

    public void setSkuType(Integer skuType) {
        this.skuType = skuType;
    }

    public String getSpec1() {
        return spec1;
    }

    public void setSpec1(String spec1) {
        this.spec1 = spec1;
    }

    public String getSpec2() {
        return spec2;
    }

    public void setSpec2(String spec2) {
        this.spec2 = spec2;
    }

    public String getSpec3() {
        return spec3;
    }

    public void setSpec3(String spec3) {
        this.spec3 = spec3;
    }

    public String getSpec4() {
        return spec4;
    }

    public void setSpec4(String spec4) {
        this.spec4 = spec4;
    }

    public Integer getCreator() {
        return creator;
    }

    public void setCreator(Integer creator) {
        this.creator = creator;
    }

    public Integer getModifier() {
        return modifier;
    }

    public void setModifier(Integer modifier) {
        this.modifier = modifier;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Integer getLifeCycle() {
        return lifeCycle;
    }

    public void setLifeCycle(Integer lifeCycle) {
        this.lifeCycle = lifeCycle;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public Date getEffectiveTime() {
        return effectiveTime;
    }

    public void setEffectiveTime(Date effectiveTime) {
        this.effectiveTime = effectiveTime;
    }

    public Date getExpiredTime() {
        return expiredTime;
    }

    public void setExpiredTime(Date expiredTime) {
        this.expiredTime = expiredTime;
    }

    public Date getFirstOnShelfTime() {
        return firstOnShelfTime;
    }

    public void setFirstOnShelfTime(Date firstOnShelfTime) {
        this.firstOnShelfTime = firstOnShelfTime;
    }

    public String getSpecName() {
        return specName;
    }

    public void setSpecName(String specName) {
        this.specName = specName;
    }
    public EsSpu getSpu() {
        return spu;
    }

    public void setSpu(EsSpu spu) {
        this.spu = spu;
    }
}
